package com.atguigu.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author ：jjt8024
 * @date ：Created in 2021/3/13 14:49
 */

@RestController
public class ConsumerController
{

    @Value("${service-url.url}")
    private String prefix;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/get/{id}")
    public String  getId(@PathVariable("id") Long id){

        return  restTemplate.getForObject(prefix+"/payment/nacos/"+id, String.class);
    }

}
